﻿using Newtonsoft.Json;

namespace Entropy.Ext
{
	public class ExtStoreViewModel
	{
		/// <summary>
		/// Corresponds to Ext.data.reader.Reader.totalProperty : String
		/// Name of the property from which to retrieve the total number of records in the dataset. 
		/// This is only needed if the whole dataset is not passed in one go, but is being paged from the remote server.
		/// Defaults to: "total"
		/// </summary>
		[JsonProperty("total")]
		public int? TotalRecords;
		/// <summary>
		/// successProperty : String
		/// Name of the property from which to retrieve the success attribute, the value of which indicates whether a given request succeeded or failed (typically a boolean or 'true'|'false'). 
		/// See Ext.data.proxy.Server.exception for additional information.
		/// Defaults to: "success"
		/// Available since: Ext 4
		/// </summary>
		[JsonProperty("success")]
		public bool? Success;

		/// <summary>
		/// messageProperty: String
		/// The name of the property which contains a response message. This property is optional.
		/// Available since: Ext 3
		/// </summary>
		[JsonProperty("message")]
		public string Message;

		/// <summary>
		/// root : String
		/// The name of the property which contains the data items corresponding to the Model(s) for which this Reader is configured. 
		/// For JSON reader it's a property name (or a dot-separated list of property names if the root is nested). For XML reader it's a CSS selector. 
		/// For Array reader the root is not applicable since the data is assumed to be a single-level array of arrays.
		/// By default the natural root of the data will be used: the root JSON array, the root XML element, or the array.
		/// The data packet value for this property should be an empty array to clear the data or show no data.
		/// Defaults to: ''
		/// </summary>
		public const string RootProperty = "root";
		[JsonProperty(RootProperty)]
		public object Root;
	}
}